package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ShoppingCartQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-16 22:58
 */
@Slf4j
public class ShoppingCartQueryClientFallback implements FallbackFactory<ShoppingCartQueryClient>{
    @Override
    public ShoppingCartQueryClient create(Throwable cause) {
        log.warn("exception in calling shoppingcartquery service" + cause);
        return new ShoppingCartQueryClient(){
            @Override
            public Result listByIds(List<String> ids) {
                return Result.internalServerError();
            }

            @Override
            public Result listVoByIds(List<String> ids) {
                return Result.internalServerError();
            }

            @Override
            public Result listVoByUserId(String userId) {
                return Result.internalServerError();
            }
        };
    }
}
